﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PhotoGallery.BLL;
public partial class forgetpw : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    //密码
    protected void Unnamed3_Click(object sender, EventArgs e)
    {
        FindPass f = new FindPass();
        Random random = new Random();
        int index = random.Next();
        string rdindex = index.ToString();
        string code = Get_MD5(index.ToString());
        if (f.findPass(this.email.Value,code))
        {
            Show(Page, "您的密码已被随机重置为"+rdindex+"，请点击上方LOGO返回登录！");
            //Response.Redirect("login.aspx");
        }
        else
            return;
    }
    public string Get_MD5(string strSource)
    {
        return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strSource, "MD5");
    }
    public static void Show(System.Web.UI.Page page, string msg)
    {
        page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
    }
}